package com.gupao.singletondemo.register;

import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class RegisterMap {


    private RegisterMap() {
    }

    private static Map<String, Object> map = new ConcurrentHashMap<>();

    public static RegisterMap getInstance(String name) {
        if (name == null) {
            name = RegisterMap.class.getName();
        }
        if (map.get(name) == null) {
            try {
                map.put(name, new RegisterMap());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return (RegisterMap) map.get(name);
    }

}
